<style lang="less">
  #div_truck_load_driver_info_dialog_sy {

  }
</style>

<template>
  <div id="div_truck_load_driver_info_dialog_sy">
    <el-dialog :visible.sync="isShowTruckLoadDriverInfoDialog" width="65%">
      <el-tabs v-model="tabName" @tab-click="tabClick">
        <el-tab-pane label="基本信息" name="baseInfo">
          <truck-load-driver-base-info v-if="baseInfo!=null" :baseInfo="baseInfo"
                                       v-on:isRefresh="$emit('isRefresh', true)"></truck-load-driver-base-info>
        </el-tab-pane>
        <el-tab-pane label="认证详情" name="authenticationInfo">
          <truck-load-driver-authentication-info v-on:isShow="isShowFun"
            :authenticationInfo="baseInfo"></truck-load-driver-authentication-info>
        </el-tab-pane>
        <el-tab-pane label="合作领头羊" name="cooperationTruckBellwether">
          <cooperation-truck-bellwether
            :cooperationTruckBellwether="baseInfo" :isRefresh="boo"></cooperation-truck-bellwether>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
  </div>
</template>

<script>
import { getTruckLoadDriverDetail } from '../../api/v3/TruckLoadDriver.js';
import TruckLoadDriverBaseInfo from './TruckLoadDriverBaseInfo.vue';
import TruckLoadDriverAuthenticationInfo from './TruckLoadDriverAuthenticationInfo.vue';
import CooperationTruckBellwether from './TruckLoadDriverCooperationTruckBellwether.vue';

export default {
  components: {
    TruckLoadDriverBaseInfo,
    TruckLoadDriverAuthenticationInfo,
    CooperationTruckBellwether
  },
  props: {
    accountInfo: {}
  },
  watch: {
    accountInfo (val) {
      let model = JSON.parse(val);
      this.baseInfo = {};
      this.isShowTruckLoadDriverInfoDialog = model.isShow;
      getTruckLoadDriverDetail(model.id).then((res) => {
        this.baseInfo = Object.assign(res.data, {time: new Date().getTime()});
      });
    }
  },
  data () {
    return {
      boo: false,
      isShowTruckLoadDriverInfoDialog: false,
      tabName: 'baseInfo',
      baseInfo: {},
      authenticationInfo: {},
      modelForm: {}
    };
  },
  methods: {
    isShowFun (val) {
      this.isShowTruckLoadDriverInfoDialog = val;
      this.$emit('isRefresh', true);
    },
    tabClick (tab, event) {
      if (tab.name === 'cooperationTruckBellwether') {
        this.boo = true;
      }
    }
  },
  mounted () {}
};
</script>
